package jdk.comparable;


public class Cat implements java.lang.Comparable<Cat>{
	private int height;
	private String name;
	private java.util.Comparator<Cat> comparator = new CatHeightComparater();
	public Cat(int height, String name) {
		super();
		this.height = height;
		this.name = name;
	}
	public int getHeight() {
		return height;
	}
	public void setHeight(int height) {
		this.height = height;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Override
	public String toString() {
		return name+"|"+height;
	}
	@Override
	public int compareTo(Cat o) {
		return comparator.compare(this, o);
	}
	public java.util.Comparator getComparator() {
		return comparator;
	}
	public void setComparator(java.util.Comparator comparator) {
		this.comparator = comparator;
	}
}
